package com.library.bookmanagement.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author ：ZXM
 * @date ：Created in 2020/4/28 11:24
 * @description：Swagger2相关配置
 */
@Configuration
@EnableSwagger2
public class Swagger2Config {

    // http://localhost:8080/swagger-ui.html
    @Bean
    public Docket creatRestfulApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("webApi")
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.library.bookmanagement"))
                .paths(PathSelectors.any())
                .build().apiInfo(new ApiInfoBuilder()
                        .title("智慧树-图书管理系统API")
                        .description("SpringBoot整合Swagger，详细信息......")
                        .version("2.7.0")
                        .build());
    }
}
